package com.orkasgb.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.orkasgb.entity.OrkasgbTaskDetailsEntity;
import com.orkasgb.mapper.OrkasgbTaskDetailsMapper;
import com.orkasgb.service.IOrkasgbTaskDetailsService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * 任务信息表(TOrkasgbTaskDetails)表服务实现类
 *
 * @version 1.0.0
 * @since 2024-09-08 21:17:23
 */
@Slf4j
@Service
public class OrkasgbTaskDetailsServiceImpl extends ServiceImpl<OrkasgbTaskDetailsMapper, OrkasgbTaskDetailsEntity> implements IOrkasgbTaskDetailsService {
	
	@Resource
	private OrkasgbTaskDetailsMapper orkasgbTaskDetailsMapper;
	
	/**
	 * 通过主键查询单条数据
	 *
	 * @param id 主键
	 * @return 单条数据
	 */
	@Override
	public OrkasgbTaskDetailsEntity getOrkasgbTaskDetails (Serializable id) {
		return this.getBaseMapper().selectById(id);
	}
	
	/**
	 * 通过条件查询多条数据
	 *
	 * @param orkasgbTaskDetailsEntity 实体查询参数
	 * @return 数据
	 */
	@Override
	public List<OrkasgbTaskDetailsEntity> getOrkasgbTaskDetailsList (OrkasgbTaskDetailsEntity orkasgbTaskDetailsEntity) {
		QueryWrapper<OrkasgbTaskDetailsEntity> queryWrapper = new QueryWrapper<>(OrkasgbTaskDetailsEntity.class);
		return this.getBaseMapper().selectList(queryWrapper);
	}
	
	/**
	 * 通过条件查询多条数据(分页查询)
	 *
	 * @param orkasgbTaskDetailsEntity 查询参数实体
	 * @return 数据
	 */
	@Override
	public List<OrkasgbTaskDetailsEntity> getOrkasgbTaskDetailsPageDataList (OrkasgbTaskDetailsEntity orkasgbTaskDetailsEntity) {
		QueryWrapper<OrkasgbTaskDetailsEntity> queryWrapper = new QueryWrapper<>(OrkasgbTaskDetailsEntity.class);
		IPage<OrkasgbTaskDetailsEntity> page = new Page<>(1, 10);
		return this.getBaseMapper().selectList(page, queryWrapper);
	}
	
	/**
	 * 新增数据
	 *
	 * @param orkasgbTaskDetailsEntity 实体对象
	 * @return 新增结果
	 */
	@Override
	public int addOrkasgbTaskDetails (OrkasgbTaskDetailsEntity orkasgbTaskDetailsEntity) {
		return this.getBaseMapper().insert(orkasgbTaskDetailsEntity);
	}
	
	/**
	 * 修改数据
	 *
	 * @param orkasgbTaskDetailsEntity 实体对象
	 * @return 修改结果
	 */
	@Override
	public int updateOrkasgbTaskDetails (OrkasgbTaskDetailsEntity orkasgbTaskDetailsEntity) {
		return this.getBaseMapper().updateById(orkasgbTaskDetailsEntity);
	}
	
	/**
	 * 修改或者新增数据
	 *
	 * @param orkasgbTaskDetailsEntityList 实体对象
	 * @return 操作结果
	 */
	@Override
	public int addOrUpdateOrkasgbTaskDetails (List<OrkasgbTaskDetailsEntity> orkasgbTaskDetailsEntityList) {
		return orkasgbTaskDetailsMapper.insertOrUpdateBatch(orkasgbTaskDetailsEntityList);
	}
	
	/**
	 * 删除数据
	 *
	 * @param idList 主键结合
	 * @return 删除结果
	 */
	@Override
	public int deleteOrkasgbTaskDetailsByIds (List<Long> idList) {
		return this.getBaseMapper().deleteByIds(idList);
	}
	
}

